package binpacking.model;

import java.util.ArrayList;

public class Bin {
	
	private ArrayList<Block> blocks;
	private int size; // amount this bin can hold
	private int current; // amount this bin currently holds
	
	public Bin(int size) {
		this.blocks = new ArrayList<Block>();
		this.size = size;
		this.current = 0;
	}
	
	public void addBlock(Block block) {	
		blocks.add( block );
		current += block.getSize();
	}
	
	public boolean storageAvailable(int blockSize) {
		return size >= (current + blockSize);
	}
	
	public int getStorageRemaining( int blockSize ){
		return size - (current + blockSize);
	}
	
	public boolean hasRoomAvailable() {
		return current < size;
	}
	
	public int getMaxSize() {
		return size;
	}
	
	public int getCurSize() {
		return current;
	}
}
